#include <iostream>
#include <string>

int main() {
    int c = 0;
    std::string a;
    std::cin >> a;
    if (a.length() == 2) {
        for (int i = 0; i < 2; ++i) {
            if (a[i] == '(' && a[i + 1] == ')') {
                c = c + 1;
            } else if (a[i] == '{' && a[i + 1] == '}') {
                c = c + 1;
            } else if (a[i] == '[' && a[i + 1] == ']') {
                c = c + 1;
            } else if (a[i] == '<' && a[i + 1] == '>') {
                c = c + 1;
            }
            if (c == 1) {
                std::cout << "True" << std::endl;
                break;
            } else {
                std::cout << "False" << std::endl;
            }
        }
    } else if (a.length() == 4) {
        for (int i = 0; i < 4; ++i) {
            if (a[i] == '(' && a[i + 1] == ')') {
                c = c + 1;
            } else if (a[i] == '{' && a[i + 1] == '}') {
                c = c + 1;
            } else if (a[i] == '[' && a[i + 1] == ']') {
                c = c + 1;
            } else if (a[i] == '<' && a[i + 1] == '>') {
                c = c + 1;
            }
        }
        if (c == 2) {
            std::cout << "True" << std::endl;
        } else {
            std::cout << "False" << std::endl;
        }
    } else if (a.length() == 6) {
        for (int i = 0; i < 3; ++i) {
            if ((a[i] == '(' && a[i + 1] == ')') || (a[i + 3] == ')')) {
                c = c + 1;
            } else if ((a[i] == '{' && a[i + 1] == '}') || (a[i + 3] == '}')) {
                c = c + 1;
            } else if ((a[i] == '[' && a[i + 1] == ']') || (a[i + 3] == ']')) {
                c = c + 1;
            } else if ((a[i] == '<' && a[i + 1] == '>') || (a[i + 3] == '>')) {
                c = c + 1;
            }
        }
        if (c == 3) {
            std::cout << "True" << std::endl;
        } else {
            std::cout << "False" << std::endl;
        }
    } else {
        std::cout << "False" << std::endl;
    }
    return 0;
}
